package com.ws.shop.action.front;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.ws.shop.action.admin.AccessoryAction;
import com.ws.shop.bean.Page;
import com.ws.shop.service.SunpicService;
import com.ws.shop.util.RequestUtil;

@Controller
@RequestMapping(value = "/sunpic/*")
public class SunpicAction  extends BaseFrontAction{
	@Autowired
	private SunpicService sunpicService;
	
	@RequestMapping(value="index.htm",method=RequestMethod.GET)//请求地址
	public String index(HttpServletRequest request,Model model){
		int pageno = RequestUtil.getIntParameter(request, Page.PAGE_NO, 1);
		int state = 1;
		Page page = sunpicService.sunpicsPage(pageno,10, state);
		model.addAttribute("page", page);
		model.addAttribute("saveImagUrl",AccessoryAction.SAVE_IMAG_URL);
		return "sunpic_index";
	}
}
